<template>
  <el-dialog
    title="还款结清"
    :visible.sync="dialogVisible"
    width="650px"
  >
    <el-form
      :inline="true"
      :model="formData"
      class="demo-form-inline"
      label-width="100px"
    >
      <el-form-item label="合同号">
        <el-input
          v-model="formData.contract_no"
          placeholder="合同号"
        />
      </el-form-item>

      <el-form-item label="结清时间">
        <el-date-picker
          v-model="formData.sett_date"
          type="date"
          placeholder="结清时间"
          value-format="yyyy-MM-dd"
        />
      </el-form-item>

    </el-form>
    <div
      slot="footer"
      class="dialog-footer"
    >
      <el-button
        size="small"
        @click="dialogVisible = false"
      >取 消</el-button>
      <el-button
        size="small"
        type="primary"
        @click="submit"
      >确 定</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { Levinwang_Over } from '@/api/marketing'
export default {
  props: {
    dialogTitle: {
      type: String
    },
    selectRow: {
      type: Object
    }
  },
  data() {
    return {
      dialogVisible: false,
      formData: {
        contract_no: '',
        sett_date: ''
      }

    }
  },
  watch: {
    dialogVisible(val) {
      if (val) {
        this.getData()
      }
    }
  },
  methods: {

    submit() {
      // this.formData = {
      //   'contract_no': 'HT-TEST001',
      //   'sett_date': '2021-10-20'
      //   // 'signature': 'D77E0FD4FBC46088511B79EA1FEFAB35'
      // }
      Levinwang_Over({ 'order_id': this.selectRow.id, 'data': this.formData }).then(res => {
        this.dialogVisible = false
        this.$message({
          message: '贷款已结清',
          type: 'success'
        })
      })
    },
    getData() {
      this.formData.contract_no = this.selectRow.trade_no
      // autoRechargeInfo(this.type).then(res => {
      //   this.infoData = { ...res } || {}
      //   this.calculate()
      // })
    },
    changeNumberInput(key, value) {
      const pattern = /^[1-9][0-9]*$/ // 正整数的正则表达式
      // 不符合正整数时
      if (!pattern.test(value)) {
        // input 框绑定的内容为空
        this.formData[key] = ''
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.form_info {
  padding: 20px 30px;
  background: #f5f5f5;
  /deep/.el-divider--horizontal {
    margin: 10px 0;
  }
}
.suffix {
  width: 28px;
  height: 28px;
  background: #e6e6e6;
  border-radius: 0px 3px 3px 0px;
  box-sizing: border-box;
  line-height: 28px;
  text-align: center;
}
.check_form {
  /deep/.el-checkbox__inner {
    border-color: #ff4146;
  }
}
.form_item {
  display: flex;
  line-height: 35px;
  & > label {
    width: 100px;
    color: #666666;
  }
  /deep/.el-input__inner {
    height: 28px;
    border-radius: 3px 0px 0px 3px;
  }
  /deep/.el-input__icon {
    line-height: 28px;
  }
}
</style>
